// JavaScript Document
define("PSlide", [], function (require, exports, module) {
    var PSlide = function (a) {
        a = a || {};
        var opts = {
            slideCell: a.slideCell,
            titCell: a.titCell || ".hd li", // 导航对象，当自动分页设为true时为“导航对象包裹层”
            mainCell: a.mainCell || ".bd", // 切换对象包裹层
            effect: a.effect || "left", // 效果，支持 left、leftLoop
            autoPlay: a.autoPlay || false, // 自动播放
            delayTime: a.delayTime || 500, // 效果持续时间
            interTime: a.interTime || 4500, // 自动运行间隔
            defaultIndex: a.defaultIndex || 0, // 默认的当前位置索引。0是第一个； defaultIndex:1 时，相当于从第2个开始执行
            titOnClassName: a.titOnClassName || "active", // 当前导航对象添加的className
            autoPage: a.autoPage || false, // 自动分页，当为true时titCell为“导航对象包裹层”
            prevCell: a.prevCell || ".prev", // 前一页按钮
            nextCell: a.nextCell || ".next", // 后一页按钮
            pageStateCell: a.pageStateCell || ".pageState", // 分页状态对象，用于显示分页状态，例如：2/3
            pnLoop: a.pnLoop == 'undefined ' ? true : a.pnLoop, // 前后按钮点击是否继续执行效果，当为最前/后页是会自动添加“prevStop”/“nextStop”控制样色
            startFun: a.startFun || null, // 每次切换效果开始时执行函数，用于处理特殊情况或创建更多效果。用法 satrtFun:function(i,c){ }； 其中i为当前分页，c为总页数
            endFun: a.endFun || null, // 每次切换效果结束时执行函数，用于处理特殊情况或创建更多效果。用法 endFun:function(i,c){ }； 其中i为当前分页，c为总页数
            switchLoad: a.switchLoad || null, //每次切换效果结束时执行函数，用于处理特殊情况或创建更多效果。用法 endFun:function(i,c){ }； 其中i为当前分页，c为总页数

            rank: a.rank || 1,
            parent: a.parent || ""
        };

        var slideCell = opts.slideCell;//document.getElementById(opts.slideCell.replace("#", ""));
        var parent = document.getElementById(opts.parent.replace("#", ""));
        if (!slideCell) return false;

        //简单模拟jquery选择器
        var obj = function (str, parEle) {
            str = str.split(" ");
            var par = [];
            parEle = parEle || document;
            var retn = [ parEle ];
            for (var i in str) {
                if (str[i].length != 0) par.push(str[i])
            } //去掉重复空格
            for (var i in par) {
                if (par.hasOwnProperty(i)) {
                    if (retn.length == 0) return false;
                    var _retn = [];
                    for (var r in retn) {
                        if (retn.hasOwnProperty(r)) {
                            if (par[i][0] == "#") _retn.push(document.getElementById(par[i].replace("#", "")));
                            else if (par[i][0] == ".") {
                                var tag = retn[r].getElementsByTagName('*');
                                for (var j = 0; j < tag.length; j++) {
                                    var cln = tag[j].className;
                                    if (cln && cln.search(new RegExp("\\b" + par[i].replace(".", "") + "\\b")) != -1) {
                                        _retn.push(tag[j]);
                                    }
                                }
                            }
                            else {
                                var tag = retn[r].getElementsByTagName(par[i]);
                                for (var j = 0; j < tag.length; j++) {
                                    _retn.push(tag[j])
                                }
                            }
                        }
                    }
                    retn = _retn;
                }
            }

            return retn.length == 0 || retn[0] == parEle ? false : retn;
        }// obj E

        // 创建包裹层
        var wrap = function (el, v) {
            var tmp = document.createElement('div');
            tmp.innerHTML = v;
            tmp = tmp.children[0];
            var _el = el.cloneNode(true);
            tmp.appendChild(_el);
            el.parentNode.replaceChild(tmp, el);
            conBox = _el; // 重置conBox
        };

        // 获取样色数值
        var getStyleVal = function (el, attr) {
            var v = 0;
            if (el.currentStyle) {
                v = el.currentStyle[attr]
            } else {
                v = getComputedStyle(el, false)[attr];
            }
            return parseInt(v.replace("px", ""))
        }

        // class处理
        var addClass = function (ele, className) {
            if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1)) return;
            ele.className += (ele.className ? " " : "") + className;
        }

        var removeClass = function (ele, className) {
            if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)) return;
            ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
        }

        //全局对象
        var effect = opts.effect;
        var prevBtn = obj(opts.prevCell, slideCell)[0];
        var nextBtn = obj(opts.nextCell, slideCell)[0];
        var pageState = obj(opts.pageStateCell)[0];
        var conBox = obj(opts.mainCell, slideCell)[0];//内容元素父层对象
        if (!conBox) return false;
        var conBoxSize = conBox.children.length;
        var navObj = obj(opts.titCell, slideCell);//导航子元素结合
        var navObjSize = navObj ? navObj.length : conBoxSize;
        var sLoad = opts.switchLoad;

        /*字符串转换*/
        var index = parseInt(opts.defaultIndex);
        var delayTime = parseInt(opts.delayTime);
        var interTime = parseInt(opts.interTime);
        var autoPlay = (opts.autoPlay == "false" || opts.autoPlay == false) ? false : true;
        var autoPage = (opts.autoPage == "false" || opts.autoPage == false) ? false : true;
        var loop = (opts.pnLoop == "false" || opts.pnLoop == false) ? false : true;
        var oldIndex = index;
        var inter = null;// autoPlay的setInterval
        var timeout = null; // leftLoop的setTimeout
        var endTimeout = null;  //translate的setTimeout

        var startX = 0;
        var startY = 0;
        var distX = 0;
        var distY = 0;
        var dist = 0; //手指滑动距离
        var isTouchPad = (/hp-tablet/gi).test(navigator.appVersion);
        var hasTouch = 'ontouchstart' in window && !isTouchPad;
        var touchStart = hasTouch ? 'touchstart' : 'mousedown';
        var touchMove = hasTouch ? 'touchmove' : 'mousemove';
        var touchEnd = hasTouch ? 'touchend' : 'mouseup';
        var resizeStart = hasTouch ? 'orientationchange' : 'resize';
        var slideH = 0;
        var slideW = 320;// mainCell滑动距离，后面会覆盖
        var selfW = 0;
        var scrollY;

        try{
            slideW = panda.system.screen().visibleWidth;
        }catch(e){}
        //处理分页
        if (navObjSize == 0)navObjSize = conBoxSize / opts.rank;
        if (autoPage) {
            navObjSize = conBoxSize / opts.rank;
            navObj = navObj[0];
            navObj.innerHTML = "";
            var str = "";

            if (opts.autoPage == true || opts.autoPage == "true") {
                for (var i = 0; i < navObjSize; i++) {
                    str += "<li class='left'></li>"
                }
            } else {
                for (var i = 0; i < navObjSize; i++) {
                    str += opts.autoPage.replace("$", (i + 1))
                }
            }

            navObj.innerHTML = str;
            navObj = navObj.children;//重置navObj
        }

        //取最大值
        for (var i = 0; i < conBoxSize; i++) {
            var chi = conBox.children[i];
            var ma = getStyleVal(chi, "marginLeft") + getStyleVal(chi, "marginRight");
            var pa = getStyleVal(chi, "paddingLeft") + getStyleVal(chi, "paddingRight");
            var chiW = chi.clientWidth - pa;
            var chiSW = chi.offsetWidth + ma + pa;
            if (chiW > selfW) {
                if (opts.rank == 2) {
                    selfW = getStyleVal(parent, "width") - pa;
                    slideW = getStyleVal(parent, "width") - (opts.rank + 1) * getStyleVal(chi, "paddingLeft");
                } else {
                    selfW = chiW;
                    slideW = chiSW;

                }
            }
        }


        switch (effect) {
            case "left":
                conBox.style.cssText = "width:" + conBoxSize * slideW + "px;" + "position:relative;overflow:hidden;padding:0;margin:0;";
                for (var i = 0; i < conBoxSize; i++) {
                    conBox.children[i].style.cssText = "float:left;width:" + Math.floor(selfW / opts.rank) + "px;"
                }
                wrap(conBox, '<div class="tempWrap" style="overflow:hidden; position:relative; width:' + slideW + 'px"></div>');
                break;
            case "leftLoop":
                conBox.appendChild(conBox.children[0].cloneNode(true));
                conBox.insertBefore(conBox.children[conBoxSize - 1].cloneNode(true), conBox.children[0]);
                conBox.style.cssText = "width:" + (conBoxSize + 2) * slideW + "px;" + "position:relative;overflow:hidden;padding:0;margin:0;";
                for (var i = 0; i < conBoxSize + 2; i++) {
                    conBox.children[i].style.cssText = "float:left;width:" + Math.floor(selfW / opts.rank) + "px;";
                }
                wrap(conBox, '<div class="tempWrap" style="position:relative; width:' + slideW + 'px"></div>');
                break;
        }

        var doStartFun = function () {
            if (typeof opts.startFun == 'function') {
                opts.startFun(index, navObjSize)
            }
        }
        var doEndFun = function () {
            if (typeof opts.endFun == 'function') {
                opts.endFun(index, navObjSize)
            }
        }
        var doSwitchLoad = function (moving) {
            var curIndex = ( effect == "leftLoop" ? index + 1 : index ) + moving;
            var changeImg = function (ind) {
                var img = conBox.children[ind].getElementsByTagName("img");
                for (var i = 0; i < img.length; i++) {
                    if (img[i].getAttribute(sLoad)) {
                        img[i].setAttribute("src", img[i].getAttribute(sLoad));
                        img[i].removeAttribute(sLoad);
                    }
                }
            }// changeImg E
            changeImg(curIndex);
            if (effect == "leftLoop") {
                switch (curIndex) {
                    case 0:
                        changeImg(conBoxSize);
                        break;
                    case 1:
                        changeImg(conBoxSize + 1);
                        break;
                    case conBoxSize:
                        changeImg(0);
                        break;
                    case conBoxSize + 1:
                        changeImg(1);
                        break;
                }
            }
        }// doSwitchLoad E

        var translate = function (dist, speed, ele) {

            if (true) {
                panda(conBox).animate({
                    left: dist
                }, speed);
            } else {
                if (!!ele) {
                    ele = ele.style;
                } else {
                    ele = conBox.style;
                }
                ele.webkitTransitionDuration = ele.MozTransitionDuration = ele.msTransitionDuration = ele.OTransitionDuration = ele.transitionDuration = speed + 'ms';
                ele.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';
                ele.msTransform = ele.MozTransform = ele.OTransform = 'translateX(' + dist + 'px)';
            }
        };

        //效果函数
        var doPlay = function (isTouch) {
            switch (effect) {
                case "left":
                    if (index >= navObjSize) {
                        index = isTouch ? index - 1 : 0;
                    } else if (index < 0) {
                        index = isTouch ? 0 : navObjSize - 1;
                    }
                    if (sLoad != null) {
                        doSwitchLoad(0)
                    }
                    translate((-index * slideW), delayTime);
                    oldIndex = index;
                    break;


                case "leftLoop":
                    if (sLoad != null) {
                        doSwitchLoad(0)
                    }
                    translate(-(index + 1) * slideW, delayTime);
                    if (index == -1) {
                        timeout = setTimeout(function () {
                            translate(-navObjSize * slideW, 0);
                        }, delayTime);
                        index = navObjSize - 1;
                    }
                    else if (index == navObjSize) {

                        timeout = setTimeout(function () {
                            if (true) {
                                panda(conBox).css({
                                    left: -slideW
                                });
                            } else {
                                translate(-slideW, 0);
                            }
                        }, delayTime);
                        index = 0;
                    }
                    oldIndex = index;
                    break;// leftLoop end

            }//switch end
            doStartFun();
            endTimeout = setTimeout(function () {
                doEndFun()
            }, delayTime);

            //设置className
            for (var i = 0; i < navObjSize; i++) {
                removeClass(navObj[i], opts.titOnClassName);
                if (i == index) {
                    addClass(navObj[i], opts.titOnClassName)
                }
            }

            if (loop == false) { //loop控制是否继续循环
                removeClass(nextBtn, "nextStop");
                removeClass(prevBtn, "prevStop");
                if (index == 0) {
                    addClass(prevBtn, "prevStop")
                }
                else if (index == navObjSize - 1) {
                    addClass(nextBtn, "nextStop")
                }
            }
            if (pageState) {
                pageState.innerHTML = "<span>" + (index + 1) + "</span>/" + navObjSize;
            }
        };// doPlay end

        //初始化执行
        doPlay();

        //自动播放
        if (autoPlay) {
            inter = setInterval(function () {
                index++;
                doPlay();
            }, interTime);
        }

        //点击事件
        if (navObj) {
            for (var i = 0; i < navObjSize; i++) {
                (function () {
                    var j = i;
                    navObj[j].addEventListener('click', function (e) {
                        clearTimeout(timeout);
                        clearTimeout(endTimeout);
                        index = j;
                        doPlay();
                    })
                })()

            }
        }
        if (nextBtn) {
            nextBtn.addEventListener('click', function (e) {
                if (loop == true || index != navObjSize - 1) {
                    clearTimeout(timeout);
                    clearTimeout(endTimeout);
                    index++;
                    doPlay();
                }
            })
        }
        if (prevBtn) {
            prevBtn.addEventListener('click', function (e) {
                if (loop == true || index != 0) {
                    clearTimeout(timeout);
                    clearTimeout(endTimeout);
                    index--;
                    doPlay();
                }
            })
        }


        //触摸开始函数
        var tStart = function (e) {
            clearTimeout(timeout);
            clearTimeout(endTimeout);
            scrollY = undefined;
            distX = 0;
            var point = hasTouch ? e.touches[0] : e;
            startX = point.pageX;
            startY = point.pageY;

            //添加“触摸移动”事件监听
            conBox.addEventListener(touchMove, tMove, false);
            //添加“触摸结束”事件监听
            conBox.addEventListener(touchEnd, tEnd, false);
        }

        //触摸移动函数
        var tMove = function (e) {
            if (hasTouch) {
                if (e.touches.length > 1 || e.scale && e.scale !== 1) return
            }
            ; //多点或缩放

            var point = hasTouch ? e.touches[0] : e;
            distX = point.pageX - startX;
            distY = point.pageY - startY;

            if (typeof scrollY == 'undefined') {
                scrollY = !!( scrollY || Math.abs(distX) < Math.abs(distY) );
            }
            if (!scrollY) {
                e.preventDefault();
                if (autoPlay) {
                    clearInterval(inter)
                }
                switch (effect) {
                    case "left":
                        if ((index == 0 && distX > 0) || (index >= navObjSize - 1 && distX < 0 )) {
                            distX = distX * 0.4
                        }
                        translate(-index * slideW + distX, 0);
                        break;
                    case "leftLoop":
                        translate(-(index + 1) * slideW + distX, 0);
                        break;
                }

                if (sLoad != null && Math.abs(distX) > slideW / 3) {
                    doSwitchLoad(distX > -0 ? -1 : 1)
                }
            }
        };

        //触摸结束函数
        var tEnd = function (e) {
            if (!hasTouch) {
                conBox.removeEventListener(touchMove, tMove, false);
                conBox.removeEventListener(touchEnd, tEnd, false);
            }


            if (distX == 0) return;
            e.preventDefault();
            if (!scrollY) {
                if (Math.abs(distX) > slideW / 10) {
                    distX > 0 ? index-- : index++;
                }
                doPlay(true);
                if (autoPlay) {
                    inter = setInterval(function () {
                        index++;
                        doPlay()
                    }, interTime);
                }
            }

            conBox.removeEventListener(touchMove, tMove, false);
            conBox.removeEventListener(touchEnd, tEnd, false);
        };

        if (hasTouch) {
            conBox.addEventListener(touchStart, tStart, false);
        }


        function resizeHandler() {
            var tw = panda(opts.slideCell).find(".tempWrap");
            tw.hide();

            setTimeout(function () {
                var wd = $(window).width();
                if (wd > 1000)
                    wd = 1000;

                tw.css("width", wd);

                var ultotal = 0;
                tw.find("li").each(function (element) {
                    panda(element).css("width", wd);
                    ultotal += wd;
                });

                tw.find("ul").css("width", ultotal);

                //取最大值
                slideW = wd;
                doPlay();

                setTimeout(function () {
                    tw.show();
                }, 230);
            }, 300);
        }

        if (top && top.location.href) {
            if (top.location.href.indexOf("preview.htm") != -1 || top.location.href.indexOf("packDown.htm") != -1) {
                setTimeout(function () {
                    resizeHandler();
                }, 1000);
            } else {
                resizeHandler();
            }
        }

        window.addEventListener(resizeStart, function () {
            resizeHandler();
        });
        window.addEventListener("resize", function () {
            resizeHandler();
        });
    };
    return PSlide;
});

panda(function (require) {
	var PSlide = require("PSlide");
	panda("div[id=jdSlider]").each(function(element){
		var pe=panda(element);
		if(!pe.attr("initslide")){
			var lilenght=pe.find("li").length;
			if(lilenght!=0&&lilenght!=1){
				PSlide({
					slideCell:element,
					titCell:".rollimage-position ul",
					mainCell:".rollimage-img ul",
					effect:"leftLoop",
					autoPage:true,
					autoPlay:true
				});
				pe.attr("initslide",true);
			}
		}
	});
});
/**
 * Created with JetBrains WebStorm.
 * User: cdzhangyin
 * Date: 14-10-16
 * Time: 下午2:24
 * To change this template use File | Settings | File Templates.
 */
panda(function () {
    var LogoElem = panda(".store-logo");
    var logoWrap = panda(".c-logo-opts");
    var slideElements = panda("div[id=jdSlider]");
    var comparePosition = function (nodeA, nodeB) {
        var positionMessage = {
            0: "元素一致",
            1: "节点在不同的文档",
            2: "B 在 A 之前",
            4: "A 在 B 之前",
            8: "B 包含 A",
            16: "节点 A 包含节点 B",
            32: "浏览器的私有使用"
        };
        return nodeA.compareDocumentPosition ?
            nodeA.compareDocumentPosition(nodeB) :
            nodeA.contains ?
                ( nodeA != nodeB && nodeA.contains(nodeB) && 16 ) +
                    ( nodeA != nodeB && nodeB.contains(nodeA) && 8 ) +
                    ( nodeA.sourceIndex >= 0 && nodeB.sourceIndex >= 0 ?
                        (nodeA.sourceIndex < nodeB.sourceIndex && 4 ) +
                            (nodeA.sourceIndex > nodeB.sourceIndex && 2 ) :
                        1 ) :
                0;
    };


    var positionStatus = true;
    if (!slideElements.length)positionStatus = false;
    for (var i = 0, Ln = slideElements.length; i < Ln; i++) {
        if (comparePosition(LogoElem[0], slideElements[i]) == 2) {
            positionStatus = true;
            break;
        }
        if (comparePosition(LogoElem[0], slideElements[i]) !== 2) {
            positionStatus = false;
            break;
        }
    }

    if (!positionStatus) {
        logoWrap.css({
            height: "3.3rem"
        });
        LogoElem.css({
            top: "0.1rem"
        })
    } else {
        logoWrap.css({
            height: "3rem"
        });
        LogoElem.css({
            top: "-0.75rem"
        })
    }
});

panda(function () {
    var shareBtn = panda(".j-m-share"),
        shareWrap = panda(".c-share-wrap"),
        shareMask = panda(".c-mask .mask"),
        cancelBtn = panda(".share-cancel"),
        winBody = panda("body");

    shareBtn.unbind("click").bind("click", function () {
        if (top.location.href.indexOf("editor") > -1) {
            return;
        }
        /**
         * 屏蔽页面的滚动
         */
        winBody.css({
            "overflow": "hidden"
        });

        winBody.bind("wheel", function () {
            return false;
        });
        winBody.bind("touchmove", function() {
            return false;
        });

        shareMask.css({
            display: "block"
        });
        shareWrap.removeClass("hide");
        shareWrap.css({
            bottom: -winBody.scrollTop()+'px'
        });
        return false;
    });

    shareMask.bind("click",function() {
        cancelBtn.trigger("click");
    });
    cancelBtn.bind("click", function () {
        winBody.css({
            overflow: "auto"
        });
        winBody.unbind("wheel");
        winBody.unbind("touchmove");
        shareMask.css({
            display: "none"
        });
        shareWrap.addClass("hide");
    })
});

panda(function () {

    var imgLazyLoad = function (arg) {
        var images = null,
            maxScroll = (document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.clientHeight,
            currentWidth = panda(window).width();

        function init() {
            if (!arg) return;
            images = panda(arg);
            if (!images.size()) return;

            domInit();
            eventInit();
            check(true);
        }

        function domInit() {
            images.each(function (item, index) {
//				if(typeof jQuery !== "undefined"){
//					var tempVal = item;
//					item = index;
//					index = tempVal;
//				}
                item = panda(item);
                item.data('lly_pos', item.position()).attr('loaded', 'no');
                var srcset = item.attr('srcset');
                srcset = srcset ? srcset.split(/\s*,\s*/) : '';
                item.data("lly_imgs", {});
                if (srcset.length) {
                    var imgs = {};
                    for (var i = 0, len = srcset.length; i < len; i++) {
                        var tem = [];
                        tem = srcset[i].split(/\s+/);
                        imgs[parseInt(tem[1], 10)] = tem[0];
                    }
                    item.data('lly_imgs', imgs);
                }
            });
        }

        function eventInit() {
            panda(window).on('scroll', srollHandle);
            panda(window).on('resize', resizeHandle);
        }

        function srollHandle() {
            var pandaWin = panda(window),
                scroll = (document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.clientHeight;
            if (scroll > maxScroll) {
                maxScroll = scroll;
                check(false);
            }

        }

        function resizeHandle() {
            var width = window.innerWidth;
            if (width != currentWidth) {
                currentWidth = width;
                check(true);
            }
            panda(window).trigger('scroll');

        }

        function check(isResize) {
            images.each(function (item, index) {
//				if(typeof jQuery !== "undefined"){
//					var tempVal = item;
//					item = index;
//					index = tempVal;
//				}
                item = panda(item);
                if (!!isResize) {
                    item.attr('loaded', 'no');
                    var imgs = item.data('lly_imgs'),
                        widths = [];
                    for (var key in imgs) {
                        widths.push(parseInt(key, 10));
                    }
                    widths.sort(function (a, b) {
                        return a - b;
                    });

                    var isHit = false;
                    for (var i = 0, len = widths.length; i < len; i++) {
                        if (currentWidth <= widths[i]) {
                            item.attr('srcd', imgs[widths[i]] + '');
                            isHit = true;
                            break;
                        }
                    }
                    if (isHit === false) {
                        item.attr('srcd', imgs[widths[widths.length - 1] + '']);
                    }
                }
                var top = item.data('lly_pos').top || item.data('lly_pos').y;
                if (item.attr('loaded') && top <= maxScroll + 160 && item.attr('src') !== item.attr('srcd')) {
                    if (item.attr('srcd')) {
                        item.attr('src', item.attr('srcd')).removeAttr('loaded');
                    } else {
                        item.removeAttr('loaded');
                    }
                }
            });
        }

        init();

    };

   imgLazyLoad('img[srcset]');
    
});
$(function () {
    var mask = $(".c-mask .mask");
    var category = $(".c-category-list");
    var isTouchPad = (/hp-tablet/gi).test(navigator.appVersion);
    var hasTouch = 'ontouchstart' in window && !isTouchPad;
    var eventType = hasTouch ? "click" : "click";
    $(".icon-nav").unbind(eventType).bind(eventType, function (event) {        
        mask.css("display", "block");
       $("body").css("overflow","hidden")
       $("body").bind("wheel",function(){})
       category.addClass("category-show-1");
       return false;
    });
    mask.unbind(eventType ).bind(eventType, function () {
        mask.css("display", "none");
        $("body").css("overflow","auto")
        $("body").unbind("wheel");
        category.removeClass("category-show-1");
        return false;
    });
    /**
     * 商家评分控制
     */
    var score = $(".score");
    var scoreValue = parseInt(score.find("span").html(), 10);
    var starElements = score.find("i");

    var Ln = Math.floor(scoreValue / 2);
    for (var i = starElements.size() - 1; i >= Ln; i--) {
        starElements.eq(i).addClass("icon-empty").removeClass("icon-full");
    }


    var header = $(".category-list");
    var categoryList = $(".c-category-list");

    header.find(".header").bind("click", function () {
        var target = panda(this);
        var list = target.next();
        if (list.find("li").size() <= 0)return;
        list.css({
            overflow: "hidden"
        });
        if (target.parent().hasClass("active")) {
            target.parent().removeClass("active");
            list.slideUp(function () {
                list.hide()
            });
        } else {
            target.parent().addClass("active");
            categoryList.css({
                height: $(window).height(),
                overflow: "auto"
            });
            list.slideDown();
        }
        return false;
    });
});